package org.logic.fuzzysets.summarizers.age;

import org.dataSource.DataBaseInfo;
import org.logic.fuzzysets.AFuzzySet;
import org.logic.membershipFunctions.TriangularFunction;

public class MiddleAgedFuzzySet extends AFuzzySet{

	public MiddleAgedFuzzySet(DataBaseInfo db) {

			double middleFactor = 0.5;
			setMembershipFunction(new TriangularFunction(db.getMinAge(),db.getMaxAge(),middleFactor));
			setUniverse(db.getAllAges());
		}
	
	public MiddleAgedFuzzySet(DataBaseInfo db, String subject) {
		
		db.setOnlyRecords(subject);
		setSubject(subject);
		double middleFactor = 0.5;
		setMembershipFunction(new TriangularFunction(db.getMinAge(),db.getMaxAge(),middleFactor));
		setUniverse(db.getAllAges());
	}

	@Override
	public String getLabel() {
		
		AFuzzySet qualifier = getQualifier();
		if(qualifier != null && getSubject()==null)
		return " who "+qualifier.getLabel()+" are middle aged";
		else
		return "are middle aged";
	}
}
